<template>
	<view @touchmove.stop.prevent="moveHandle">
		<uni-popup ref="popup" type="bottom" :safe-area='false'>
			<view class="pop-box">
				<view class="pop-main-box">
					<view class="pop-main">
						<image class="pop-img" @click="previewImage" :show-menu-by-longpress="true"
							src="@/static/main-icon/success.png" mode=""></image>
						<view class="pop-title">核销成功！</view>
					</view>
				</view>
				<view class="footer-btn">
					<view class="back-btn" @click="timeupEvent">
						返回
						（<uni-countdown ref="timer" @timeup="timeupEvent" :showDay="false" color="#333" :fontSize='15'
								:showHour="false" :showMinute="false" :second="sec"></uni-countdown>s）
					</view>
					<view class="scan-btn" @click="scanCode">继续扫</view>
				</view>
			</view>

		</uni-popup>
	</view>
</template>

<script>
	export default {
		props: {

		},
		data() {
			return {
				current: 0,
				sec:3
			}
		},
		methods: {
			// 禁止弹窗滚动
			moveHandle() {
				return false
			},
			btnEvent(index) {
				this.current = index
			},
			// 打开弹窗
			openPop() {
				// 通过组件定义的ref调用uni-popup方法 ,如果传入参数 ，type 属性将失效 ，仅支持 ['top','left','bottom','right','center']
				this.$refs.timer.update()
				this.$refs.popup.open('center')
			},
			// 返回
			timeupEvent() {
				this.$refs.popup.close()
			},
			// 继续扫
			scanCode(){
				this.$refs.popup.close()
				this.$emit('scanCode')
			},
			// 图片转发
			previewImage(e) {
				uni.previewImage({
					// 需要预览的图片链接列表
					urls: [],
					// 为当前显示图片的链接/索引值
					current: 'https://blbt-1324016866.cos.ap-guangzhou.myqcloud.com/2024/03/15/fa96ff1cdd70407eb62eaaf6485f8b44.jpg',
					// 图片指示器样式	
					indicator: 'default',
					// 是否可循环预览
					loop: false,
					// 长按图片显示操作菜单，如不填默认为保存相册
					// longPressActions:{
					// 	itemList:[this.l('发送给朋友'),this.l]
					// },
					success: res => {
						console.log('res', res);
					},
					fail: err => {
						console.log('err', err);
					}
				});
			},
			callNumber() {
				uni.makePhoneCall({
					phoneNumber: '19927283081'
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.pop-box {
		background-color: #FFFFFF;
		border-radius: 30rpx;
		box-sizing: border-box;

		.pop-main-box {
			width: 560rpx;
			height: 320rpx;
			display: flex;
			align-items: center;
			justify-content: center;
		}

		.pop-main {
			.pop-img {
				width: 147rpx;
				height: 112rpx;
			}

			.pop-title {
				margin-top: 30rpx;
				font-weight: bold;
				font-size: 36rpx;
				color: #333333;
				text-align: center;
			}
		}

		.footer-btn {
			border-top: 1px solid #EEE;
			height: 100rpx;
			display: flex;
			align-items: center;
			justify-content: space-between;
		}

		.back-btn {
			flex: 1;
			display: flex;
			align-items: center;
			justify-content: center;
			border-right: 1px solid #EEE;
		}

		.scan-btn {
			flex: 1;
			display: flex;
			align-items: center;
			justify-content: center;
			color: #94DEF9;
		}

	}
</style>